/***********************************************************************
** Copyright (C) 2011 Anthony Naddeo <anthony.naddeo@gmail.com>
**
** This file is part of LinkedUp
**
** LinkedUp is free software; you can redistribute it and/or modify
** it under the terms of the GNU General Public License as published by
** the Free Software Foundation; either version 3 of the License, or
** (at your option) any later version.
**
** LinkedUp is distributed in the hope that it will be useful,
** but WITHOUT ANY WARRANTY; without even the implied warranty of
** MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
** GNU General Public License for more details.
**
** You should have received a copy of the GNU General Public License
** along with this package; If not, see <http://www.gnu.org/licenses/>.
**
***********************************************************************/

#ifndef LINKEDINAPI_H
#define LINKEDINAPI_H

#include <QObject>
#include <QStringList>
#include "creds.h"


extern "C" {
#include "oauth.h"
}

class LinkedInAPI : public QObject
{
    Q_OBJECT

public:
    explicit LinkedInAPI(QObject *parent = 0);
	~LinkedInAPI();

	/*Core functions*/
	QString api_request(QString url);
	QString api_delete(QString url);
	QStringList api_post(QString url, QString body);
	QStringList api_put(QString url, QString body);
	QString generate_header(char* params);


	/*Member API*/
	Q_INVOKABLE QString get_person_current();
	Q_INVOKABLE QString get_person_by_id(QString id);
	Q_INVOKABLE QString get_person_public_by_id(QString id);
	Q_INVOKABLE QString get_person_following_company();
	Q_INVOKABLE QString get_person_bookmark_job();

	/*Groups API*/
	Q_INVOKABLE QString get_user_groups();

	/*Connections API*/
	Q_INVOKABLE QString get_connections_current();
	Q_INVOKABLE QString get_connections_by_id(QString id);

	/*Company API*/
	Q_INVOKABLE QString get_company_by_id(QString id);
	Q_INVOKABLE QString get_company_suggestions();
	Q_INVOKABLE QString get_company_following(QString start, QString count);
	Q_INVOKABLE QString delete_company_following(QString id);
	Q_INVOKABLE QStringList post_company_follow(QString id);

	/*Job API*/
	Q_INVOKABLE QString get_job_bookmarks(QString start, QString count);
	Q_INVOKABLE QString get_job_by_id(QString id);
	Q_INVOKABLE QString delete_job_bookmark(QString id);
	Q_INVOKABLE QStringList post_job_bookmark(QString id);

	/*Search API*/
	Q_INVOKABLE QString search_person(QString search, QString start, QString count);
	Q_INVOKABLE QString search_company(QString search, QString start, QString count);
	Q_INVOKABLE QString search_job(QString search, QString start, QString count);

	/*Updates API*/
	Q_INVOKABLE QString get_updates_current();
	Q_INVOKABLE QString get_updates_by_id(QString id);
	Q_INVOKABLE QString get_shares_current();
	Q_INVOKABLE QStringList post_status(QString status);
	Q_INVOKABLE QStringList post_share(QString post_body);

	/*Comment and Like API*/
	Q_INVOKABLE QStringList put_like(QString networkKey, QString boolean);
	Q_INVOKABLE QStringList post_comment(QString networkKey, QString comment);

	/*Messaging API*/
	Q_INVOKABLE QStringList post_message(QString post_body);
	Q_INVOKABLE QStringList post_invitation(QString email, QString firstName, QString lastName, QString subjectBody, QString message);

};

#endif // LINKEDINAPI_H
